from flask import Response


class RestResponse(Response):

    def __init__(self, error_no=0, error_message=None):
        super(RestResponse, self).__init__()
        self.response = {
            'error_no': error_no,
            'error_message': error_message,
            'data': ''
        }

    def body(self, data):
        self.response['data'] = data
        return self
